
var BankConstants = {

    BALO_21001_00 : "BALO-21001-00",
    BALO_21001_05 : "BALO-21001-05",
    BALO_21001_10 : "BALO-21001-10",
    BALO_21001_15 : "BALO-21001-15",
    BALO_21001_20 : "BALO-21001-20",
    BALO_21001_25 : "BALO-21001-25",
    BALO_21001_30 : "BALO-21001-30",
    BALO_21001_35 : "BALO-21001-35",
    BALO_21001_40 : "BALO-21001-40",
    BALO_99601_15 : "BALO-99601-15",
    BALO_99999_99 : "BALO-99999-99",

    BALO_22001_05 : "BALO-22001-05",
    BALO_22001_10 : "BALO-22001-10",
    BALO_22002_10 : "BALO-22002-10",
    BALO_22003_10 : "BALO-22003-10",
    BALO_22004_10 : "BALO-22004-10",
    BALO_22005_10 : "BALO-22005-10",
    BALO_22006_10 : "BALO-22006-10",
    BALO_22006_20 : "BALO-22006-20",
    BALO_22101_10 : "BALO-22101-10",
    BALO_22102_10 : "BALO-22102-10",
    BALO_22103_10 : "BALO-22103-10",
    BALO_22104_10 : "BALO-22104-10",
    BALO_22105_10 : "BALO-22105-10",
    BALO_22106_10 : "BALO-22106-10",
    BALO_22107_10 : "BALO-22107-10",
    BALO_22201_10 : "BALO-22201-10",
    BALO_22202_10 : "BALO-22202-10",
    BALO_22203_10 : "BALO-22203-10",
    BALO_20304_30 : "BALO-20304-30",
    BALO_21301_10 : "BALO-21301-10",
    BALO_21401_10 : "BALO-21401-10",
    BALO_23001_10 : "BALO-23001-10",
    BACR_20306_30 : "BACR-20306-30",
    BACR_21301_10 : "BACR-21301-10",
    BACR_21401_10 : "BACR-21401-10",
    BALO_99601_05 : "BALO-99601-05",
    BALO_99601_10 : "BALO-99601-10",
    BALO_99601_20 : "BALO-99601-20",
    BALO_99601_30 : "BALO-99601-30",
    BALO_99601_40 : "BALO-99601-40",
    BALO_99601_50 : "BALO-99601-50",
    BACR_99601_60 : "BACR-99601-60",
    BACR_99601_70 : "BACR-99601-70",
    BACR_99601_80 : "BACR-99601-80",
    BACR_99601_90 : "BACR-99601-90",
    BALO_99602_00 : "BALO-99602-00",
    BALO_99602_01 : "BALO-99602-01",
    BACR_99602_10 : "BACR-99602-10",
    BACR_99602_20 : "BACR-99602-20",
    BALO_99602_30 : "BALO-99602-30",
    BALO_99602_40 : "BALO-99602-40",
    BALO_99602_45 : "BALO-99602-45",
    BALO_99602_50 : "BALO-99602-50",
    BALO_99602_55 : "BALO-99602-55",
    BALO_99602_60 : "BALO-99602-60",
    BALO_99602_65 : "BALO-99602-65",
    BALO_99603_10 : "BALO-99603-10",
    BALO_99603_15 : "BALO-99603-15" ,
    BALO_99603_20 : "BALO-99603-20" ,
    BALO_99603_25 : "BALO-99603-25" ,
    BALO_99603_30 : "BALO-99603-30" ,
    BALO_99603_35 : "BALO-99603-35" ,
    BALO_99603_40 : "BALO-99603-40" ,
    BALO_99603_45 : "BALO-99603-45" ,
    BALO_99604_10 : "BALO-99604-10",
    BALO_99604_15 : "BALO-99604-15" ,
    BALO_99604_20 : "BALO-99604-20" ,
    BALO_99604_25 : "BALO-99604-25" ,
    BALO_99604_30 : "BALO-99604-30" ,
    BALO_99604_35 : "BALO-99604-35" ,
    BALO_99604_40 : "BALO-99604-40" ,
    BALO_99604_45 : "BALO-99604-45" ,
    BALO_99604_50 : "BALO-99604-50" ,
    BALO_99604_55 : "BALO-99604-55" ,
    BALO_99604_60 : "BALO-99604-60" ,
    BALO_99604_65 : "BALO-99604-65" ,
    BALO_99605_05 : "BALO-99605-05" ,
    BALO_99605_10 : "BALO-99605-10" ,
    BALO_99605_15 : "BALO-99605-15" ,
    BALO_99605_20 : "BALO-99605-20" ,
    BALO_99605_25 : "BALO-99605-25"
};

//将错误码增加到全局变量中
for(var errorCodeDeclare in BankConstants) {
    _G[errorCodeDeclare] = BankConstants[errorCodeDeclare]
    eval(errorCodeDeclare + " = BankConstants[errorCodeDeclare]")
    // print("初始化错误码到全局变量中" + errorCodeDeclare + "='" + BankConstants[errorCodeDeclare] + "'")
}

var errorMsgMap = new LinkedHashMap();
with(Object.bindProperties({}, errorMsgMap)) {

    put(BALO_21001_00, "用户名未正确输入")
    put(BALO_21001_05, "身份证号未正确输入")
    put(BALO_21001_10, "手机号未正确输入")
    put(BALO_21001_15, "借记卡号未正确输入")
    put(BALO_21001_20, "信用卡号未正确输入")
    put(BALO_21001_25, "客户号未正确输入")
    put(BALO_21001_30, "邮箱账号未正确输入")
    put(BALO_21001_35, "图片验证码未正确输入")
    put(BALO_21001_40, "信用卡三位验证码未正确输入")
    put(BALO_99601_15, "代理服务异常")
    put(BALO_99999_99, "[%s], 请联系银行客服")

    put(BALO_22001_05, "登录失败")
    put(BALO_22001_10, "用户名或密码错误，请重新输入")
    put(BALO_22002_10, "您输入的密码错误次数已超限。请在次日重试或通过“忘记密码”重置，也可在柜台重置。")
    put(BALO_22003_10, "您的密码过于简单，请登录官网重置")
    put(BALO_22004_10, "您登录密码已超过六个月未修改，为了您网银的安全使用，请修改登录密码")
    put(BALO_22005_10, "您还未设置查询/登录密码，请先登录官网设置")
    put(BALO_22006_10, "登录异常需重试")
    put(BALO_22006_20, "软键盘解析失败需重试")
    put(BALO_22101_10, "尚未注册或无此用户")
    //修改自登录方式错误
    put(BALO_22102_10, "暂不支持该种登录方式，请换其他登录方式")
    put(BALO_22103_10, "你的卡片尚未激活，请先激活")
    put(BALO_22104_10, "您的卡片已经挂失")
    put(BALO_22105_10, "您的个人网银已通过手机短信申请冻结")
    put(BALO_22106_10, "您需要完善登录信息,请先到官网进行登录")
    put(BALO_22107_10, "没有查询到您的用户信息，请先尝试官网登陆或与客服联系")
    put(BALO_22201_10, "验证码错误或已超时")
    put(BALO_22202_10, "短信验证码发送过于频繁，请稍后再试")
    put(BALO_22203_10, "登陆失败，无法使用附属卡登陆，请使用主卡卡号登陆")
    put(BALO_20304_30, "未获取到卡片信息，请登录官网绑定卡片")
    put(BALO_21301_10, "系统繁忙，请稍候再试(登录前)")
    put(BALO_21401_10, "系统维护中，请稍候再试(登录前)")
    put(BALO_23001_10, "新出现的错误提示，我方尚未归类(登录前)")
    put(BACR_21301_10, "系统繁忙，请稍候再试(登录后)")
    put(BACR_21401_10, "系统维护中，请稍候再试(登录后)")
    put(BALO_99601_10, "代理IP异常")
    put(BALO_99601_20, "密码因控件输入错误")
    put(BALO_99601_30, "登录超时")
    put(BALO_99601_40, "抓取需要的必须参数没有提取到")
    put(BALO_99601_50, "页面跳转超时")
    put(BACR_20306_30, "消费明细获取失败")
    put(BACR_99601_60, "新出现的错误提示，我方尚未归类(登录后)")
    put(BACR_99601_70, "用户已冻结")
    put(BACR_99601_80, "LuaX进程已被守护线程杀死")
    put(BACR_99601_90, "登录成功后请求未成功获取到基本数据")
    put(BALO_99602_00, "校园版客户，暂未支持网银登录")
    put(BALO_99602_01, "您的手机已经被其他用户使用")
    put(BACR_99602_10, "根据客户指令，本次登陆强行退出")
    put(BACR_99602_20, "会话超时")
    put(BALO_99602_30, "卡片状态不正常,无法登陆")
    put(BALO_99601_05, "任务创建失败")
    put(BALO_99602_40, "短信验证码错误")
    put(BALO_99602_45, "短信验证码超时")
    put(BALO_99602_50, "图片验证码错误")
    put(BALO_99602_55, "图片验证码超时")
    put(BALO_99602_60, "用户回答问题错误")
    put(BALO_99602_65, "用户回答问题超时")
    put(BALO_99603_10, "该用户不支持手机号登录方式")
    put(BALO_99603_15, "该用户不支持信用卡号登录方式")
    put(BALO_99603_20, "该用户不支持借记卡号登录方式")
    put(BALO_99603_25, "该用户不支持用户名登录方式")
    put(BALO_99603_30, "该用户不支持邮箱登录方式")
    put(BALO_99603_35, "该用户不支持用户编号登录方式")
    put(BALO_99603_45, "该用户不支持身份证号登录方式")
    put(BALO_99604_10, "该银行不支持手机号登录方式")
    put(BALO_99604_15, "该银行不支持信用卡号登录方式")
    put(BALO_99604_20, "该银行不支持借记卡号登录方式")
    put(BALO_99604_25, "该银行不支持用户名登录方式")
    put(BALO_99604_30, "该银行不支持邮箱登录方式")
    put(BALO_99604_35, "该银行不支持用户编号登录方式")
    put(BALO_99604_45, "该银行不支持身份证号登录方式")
    put(BALO_99604_50, "暂不支持该银行")
    put(BALO_99604_55, "插件未安装")
    put(BALO_99604_60, "打码服务异常")
    put(BALO_99604_65, "数据存储异常")
    put(BALO_99605_05, "特殊按键已按下")
    put(BALO_99605_10, "调用未定义JS函数或变量")
    put(BALO_99605_15, "系统内部严重错误")
    put(BALO_99605_20, "解析过程中出现异常")
    put(BALO_99605_25, "银行内部系统错误")
}

var errorCode2StatusMappings = new LinkedHashMap();
with(Object.bindProperties({}, errorCode2StatusMappings)) {

    put(BALO_21001_00, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_05, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_15, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_20, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_25, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_30, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_35, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21001_40, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99601_15, (TaskUserStatus.LOGINING.getStatus()))
    put(BALO_99999_99, (TaskUserStatus.LOGIN_FAILED.getStatus()))

    put(BALO_22001_05, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22001_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22002_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22003_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22004_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22005_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22006_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22006_20, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22101_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22102_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22103_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22104_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22105_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22106_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22107_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22201_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22202_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_22203_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_20304_30, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21301_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_21401_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_23001_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99605_05, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BACR_20306_30, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BACR_21301_10, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BACR_21401_10, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BALO_99601_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99601_20, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99601_30, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99601_40, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BALO_99601_50, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BACR_99601_60, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BACR_99601_70, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BACR_99601_80, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BACR_99601_90, (TaskUserStatus.DATA_FETCH_FAILED.getStatus()))
    put(BALO_99602_00, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_01, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BACR_99602_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BACR_99602_20, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_30, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_40, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_45, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_50, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_55, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_60, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99602_65, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_15, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_20, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_25, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_30, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_35, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99603_45, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_15, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_20, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_25, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_30, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_35, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_45, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BACR_20306_30, (TaskUserStatus.DATA_STORE_FAILED.getStatus()))
    put(BALO_99604_50, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_55, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_60, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99604_65, (TaskUserStatus.DATA_STORE_FAILED.getStatus()))
    put(BALO_99605_05, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99605_10, (TaskUserStatus.LOGIN_FAILED.getStatus()))
    put(BALO_99605_15, (TaskUserStatus.TASK_DONE_FAILED.getStatus()))
    put(BALO_99605_20, (TaskUserStatus.TASK_DONE_FAILED.getStatus()))
    put(BALO_99605_20, (TaskUserStatus.DATA_EXTRACTING.getStatus()))
}

var errorCodeToUserErrorCode = new LinkedHashMap();
with(Object.bindProperties({}, errorCodeToUserErrorCode)) {

    put(BALO_21001_00, BALO_21301_10)
    put(BALO_21001_05, BALO_21301_10)
    put(BALO_21001_10, BALO_21301_10)
    put(BALO_21001_15, BALO_21301_10)
    put(BALO_21001_20, BALO_21301_10)
    put(BALO_21001_25, BALO_21301_10)
    put(BALO_21001_30, BALO_21301_10)
    put(BALO_21001_35, BALO_21301_10)
    put(BALO_21001_40, BALO_21301_10)
    put(BALO_99601_15, BALO_21301_10)

    put(BALO_23001_10, BALO_21301_10)
    put(BALO_99601_10, BALO_21301_10)
    put(BALO_99601_20, BALO_21301_10)
    put(BALO_99601_40, BALO_21301_10)
    put(BACR_99601_60, BACR_21301_10)
    put(BACR_99601_80, BACR_21301_10)
    put(BACR_99601_90, BACR_20306_30)
    put(BACR_99602_20, BACR_21301_10)
    put(BALO_99601_05, BACR_21301_10)
    put(BALO_99604_55, BACR_21301_10)
    put(BALO_99605_05, BACR_21301_10)
    put(BALO_99604_60, BACR_21301_10)
    put(BALO_99605_10, BACR_21301_10)
    put(BALO_99605_15, BACR_21301_10)
    put(BALO_99601_50, BACR_21301_10)
    put(BALO_99604_65, BACR_21301_10)
}

function isMonitoredErrorCode(exceptErrorCode) {
    var monitoredErrorCodes = [
        BALO_21001_00, BALO_21001_05, BALO_21001_10,
        BALO_21001_15, BALO_21001_20, BALO_21001_25,
        BALO_21001_30, BALO_21001_35, BALO_99601_15, //BALO_21001_40,

        BALO_21301_10, BALO_23001_10, BALO_99601_05,
        BALO_99601_10, BALO_99601_20, BALO_99601_40,
        BACR_20306_30, BACR_99601_60, BACR_99601_80,
        BACR_99601_90, BACR_99602_20, BALO_99602_55,
        BALO_99604_50, BALO_99604_55, BALO_99604_60,
        BALO_99604_65, BALO_99605_05, BALO_99605_10,
        BALO_99605_15, BALO_99601_50, BALO_99602_50,
        BALO_99601_30,
    ]

    for (var i = 0; i < monitoredErrorCodes.length; i++) {
        if (exceptErrorCode === monitoredErrorCodes[i]) {
            return true;
        }
    }
    return false;
}


